package com.itfenghuang.day16;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

/*
继承HttpServlet的实现步骤
 */
public class A03_HttpServlet extends HttpServlet {
    /*
    1.实现步骤:
        1).编写一个普通的类继承HttpServlet,重写doGer()方法  doPost()方法
        2).在Web.xml配置一个Servlet
        3).测试
            a.重启tomcat,在浏览器上输入对应的网址

     */
//    如果get请求执行doGet方法
    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        System.out.println("胸大不给看,奶水少一半");
    }
//        如果是post请求执行该方法
    @Override
    protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        doGet(req,resp);
    }
}
